
Skt.UniqueIdManager = L.Class.extend({
	
	initialize: function(sketchpad) {
		this._nextId = 0;
		this._couple(sketchpad.getOptions().coupling);
	},
	
	getNextId: function() {
		this.updateState();
		++this._nextId;
		return "" + this._nextId;
	},
	
	updateState: function() {},
	
	getState: function() {
		var self = this;
		return {
			nextId: self._nextId
		};
	},
	
	setState: function(state) {
		var self = this;
		self._nextId = state.nextId;
	},
	
	_couple: function(coupling) {
		if ( coupling.enabled ) {
			coupling.activityAdapter.coupleObject(
				"uniqueidmanager",
				this,
				{
					messageType: "STATE",
					explicitMapping: ["updateState"]
				}
			);
		}
	}
	
});

Skt.UniqueIdManager.findSelf = function() {
	return Skt.sketchpad.getUniqueIdManager();
};
